

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>brevitas.utils package &mdash; Brevitas 0.2.0-alpha documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> Brevitas
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">brevitas.utils package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-brevitas.utils.logging">brevitas.utils.logging module</a></li>
<li><a class="reference internal" href="#module-brevitas.utils.python_utils">brevitas.utils.python_utils module</a></li>
<li><a class="reference internal" href="#module-brevitas.utils.quant_utils">brevitas.utils.quant_utils module</a></li>
<li><a class="reference internal" href="#module-brevitas.utils.torch_utils">brevitas.utils.torch_utils module</a></li>
<li><a class="reference internal" href="#module-brevitas.utils">Module contents</a></li>
</ul>
</li>
</ul>
</div>
            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">Brevitas</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>brevitas.utils package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/brevitas.utils.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="brevitas-utils-package">
<h1>brevitas.utils package<a class="headerlink" href="#brevitas-utils-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-brevitas.utils.logging">
<span id="brevitas-utils-logging-module"></span><h2>brevitas.utils.logging module<a class="headerlink" href="#module-brevitas.utils.logging" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="brevitas.utils.logging.LogActivationBitWidth">
<em class="property">class </em><code class="sig-prename descclassname">brevitas.utils.logging.</code><code class="sig-name descname">LogActivationBitWidth</code><span class="sig-paren">(</span><em class="sig-param">model</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.logging.LogActivationBitWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#brevitas.utils.logging.LogBitWidth" title="brevitas.utils.logging.LogBitWidth"><code class="xref py py-class docutils literal notranslate"><span class="pre">brevitas.utils.logging.LogBitWidth</span></code></a></p>
<dl class="method">
<dt id="brevitas.utils.logging.LogActivationBitWidth.register_hooks">
<code class="sig-name descname">register_hooks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.logging.LogActivationBitWidth.register_hooks" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="brevitas.utils.logging.LogBitWidth">
<em class="property">class </em><code class="sig-prename descclassname">brevitas.utils.logging.</code><code class="sig-name descname">LogBitWidth</code><span class="sig-paren">(</span><em class="sig-param">model</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.logging.LogBitWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="brevitas.utils.logging.LogBitWidth.register_hooks">
<em class="property">abstract </em><code class="sig-name descname">register_hooks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.logging.LogBitWidth.register_hooks" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="brevitas.utils.logging.LogWeightBitWidth">
<em class="property">class </em><code class="sig-prename descclassname">brevitas.utils.logging.</code><code class="sig-name descname">LogWeightBitWidth</code><span class="sig-paren">(</span><em class="sig-param">model</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.logging.LogWeightBitWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#brevitas.utils.logging.LogBitWidth" title="brevitas.utils.logging.LogBitWidth"><code class="xref py py-class docutils literal notranslate"><span class="pre">brevitas.utils.logging.LogBitWidth</span></code></a></p>
<dl class="method">
<dt id="brevitas.utils.logging.LogWeightBitWidth.register_hooks">
<code class="sig-name descname">register_hooks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.logging.LogWeightBitWidth.register_hooks" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-brevitas.utils.python_utils">
<span id="brevitas-utils-python-utils-module"></span><h2>brevitas.utils.python_utils module<a class="headerlink" href="#module-brevitas.utils.python_utils" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="brevitas.utils.python_utils.AutoName">
<em class="property">class </em><code class="sig-prename descclassname">brevitas.utils.python_utils.</code><code class="sig-name descname">AutoName</code><a class="headerlink" href="#brevitas.utils.python_utils.AutoName" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">enum.Enum</span></code></p>
<p>An enumeration.</p>
</dd></dl>

</div>
<div class="section" id="module-brevitas.utils.quant_utils">
<span id="brevitas-utils-quant-utils-module"></span><h2>brevitas.utils.quant_utils module<a class="headerlink" href="#module-brevitas.utils.quant_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="brevitas.utils.quant_utils.has_learned_activation_bit_width">
<code class="sig-prename descclassname">brevitas.utils.quant_utils.</code><code class="sig-name descname">has_learned_activation_bit_width</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.quant_utils.has_learned_activation_bit_width" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="brevitas.utils.quant_utils.has_learned_weight_bit_width">
<code class="sig-prename descclassname">brevitas.utils.quant_utils.</code><code class="sig-name descname">has_learned_weight_bit_width</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.quant_utils.has_learned_weight_bit_width" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-brevitas.utils.torch_utils">
<span id="brevitas-utils-torch-utils-module"></span><h2>brevitas.utils.torch_utils module<a class="headerlink" href="#module-brevitas.utils.torch_utils" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="brevitas.utils.torch_utils.TupleSequential">
<em class="property">class </em><code class="sig-prename descclassname">brevitas.utils.torch_utils.</code><code class="sig-name descname">TupleSequential</code><span class="sig-paren">(</span><em class="sig-param">*args</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.torch_utils.TupleSequential" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">torch.nn.modules.container.Sequential</span></code></p>
<dl class="method">
<dt id="brevitas.utils.torch_utils.TupleSequential.forward">
<code class="sig-name descname">forward</code><span class="sig-paren">(</span><em class="sig-param">*input</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.torch_utils.TupleSequential.forward" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the computation performed at every call.</p>
<p>Should be overridden by all subclasses.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Although the recipe for forward pass needs to be defined within
this function, one should call the <code class="xref py py-class docutils literal notranslate"><span class="pre">Module</span></code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="brevitas.utils.torch_utils.TupleSequential.output">
<code class="sig-name descname">output</code><span class="sig-paren">(</span><em class="sig-param">mod</em>, <em class="sig-param">input</em><span class="sig-paren">)</span><a class="headerlink" href="#brevitas.utils.torch_utils.TupleSequential.output" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-brevitas.utils">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-brevitas.utils" title="Permalink to this headline">¶</a></h2>
</div>
</div>


           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Alessandro Pappalardo

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>